<div>
    {if $showTixi}
    <div class="layui-inline">
        <label class="layui-form-label">体系：</label>
        <div class="layui-input-inline" style="width:240px;">
            <select name="tixi_id" id="tixi_id" lay-filter="tixi_id" lay-search="" xm-select-width="auto"  xm-select="tixi_id" xm-select-search xm-select-search-type="dl">
                {foreach $tixi_list as $key=>$val}
                <option value="{$key}">{$val}</option>
                {/foreach}
            </select>
        </div>
    </div>
    {/if}
    {if $showUserid}
    <div class="layui-inline">
        <label class="layui-form-label">用户id：</label>
        <div class="layui-input-inline">
            <input type="text" name="userid" id="userid" placeholder="用户id" value="{if $param['userid']}{$param['userid']}{/if}" class="layui-input">
        </div>
    </div>
    {/if}

    {if $showTimeReg}
    <div class="layui-inline" style="width: 150px">
        <label>注册：</label>
        <div class="layui-input-inline" style="width: 90px;">
            <input type="text" class="layui-input" name="starttime_reg" id="starttime_reg" value="{$starttime_reg}" placeholder="yyyy-MM-dd">
        </div>
    </div>
    <div class="layui-inline" style="width: 140px">
        <label> ~ </label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" class="layui-input" name="endtime_reg" value="{$endtime_reg}" id="endtime_reg" placeholder="yyyy-MM-dd">
        </div>
    </div>
    {/if}
    {if $showTimePay}
    <div class="layui-inline" style="width: 150px">
        <label>最后充值：</label>
        <div class="layui-input-inline" style="width: 90px;">
            <input type="text" class="layui-input" name="starttime_pay" id="starttime_pay" value="{$starttime_pay}" placeholder="yyyy-MM-dd">
        </div>
    </div>
    <div class="layui-inline" style="width: 140px">
        <label> ~ </label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" class="layui-input" name="endtime_pay" value="{$endtime_pay}" id="endtime_pay" placeholder="yyyy-MM-dd">
        </div>
    </div>
    {/if}
    {if $showTimeLogin}
    <div class="layui-inline" style="width: 150px">
        <label>最后登录：</label>
        <div class="layui-input-inline" style="width: 90px;">
            <input type="text" class="layui-input" name="starttime_login" id="starttime_login" value="{$starttime_login}" placeholder="yyyy-MM-dd">
        </div>
    </div>
    <div class="layui-inline" style="width: 140px">
        <label> ~ </label>
        <div class="layui-input-inline" style="width: 100px;">
            <input type="text" class="layui-input" name="endtime_login" value="{$endtime_login}" id="endtime_login" placeholder="yyyy-MM-dd">
        </div>
    </div>
    {/if}
    {if $showDep}
    <div class="layui-inline">
        <label class="layui-form-label">部门：</label>
        <div class="layui-input-inline">
            <select name="depid" id="depid" lay-filter="aihao" lay-search>
                <option value="">请选择部门</option>
                {foreach $dep as $key=>$val}
                <option value="{$key}">{$val}</option>
                {/foreach}
            </select>
        </div>
    </div>
    {/if}
    {if $showAgents}
    <div class="layui-inline">
        <label class="layui-form-label">身份：</label>
        <div class="layui-input-inline">
            <select name="platform" id="platform" lay-filter="aihao">
                <option value="">全部</option>
                <option value="0">玩家</option>
                <option value="1">代理</option>
                <option value="3">推广员</option>
            </select>
        </div>
    </div>
    {/if}
</div>

<div style="margin-top: 20px">
    <div class="layui-inline" style="margin-left: 40px">
        <button type="button" id="submit" class="layui-btn" lay-submit="" lay-filter="demo1">查询</button>
        <button type="button" id="reset" class="layui-btn layui-btn-primary">重置</button>
        <button type="button" id="export" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="demo1">导出Excel</button>
        {if $showSetCols}
        <button type="button" id="set_cols" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="set_cols">保存当前表头</button>
        {/if}
    </div>
</div>
<input type="hidden" id="model_type" name="model_type" value="{$model_type}">
<script src="/static/layui/fromselect/formSelects-v4.js?v=0.0.2"></script>
<script>

    function modelType(obj) {
        var id = $(obj).data('id');
        var model_type = 'app';
        if (id === 'model_type_app'){
            $("#model_type_app").removeClass('layui-btn-primary');
            $("#model_type_app").addClass('layui-btn-danger');
            $("#model_type_box").removeClass('layui-btn-danger');
            $("#model_type_box").addClass('layui-btn-primary');
            $("#model_type").val('app');
        }else{
            $("#model_type_box").removeClass('layui-btn-primary');
            $("#model_type_box").addClass('layui-btn-danger');
            $("#model_type_app").removeClass('layui-btn-danger');
            $("#model_type_app").addClass('layui-btn-primary');
            $("#model_type").val('box');
            model_type = 'box';
        }
        $("#mpkg_appid").empty();
        $("#skin_appid").empty();
        layui.form.render("select");
        layui.formSelects.render('skin_appid');
        var url = '?r=adDayData/list&mode=ajax&action=mpkg&model_type='+model_type;
        $.get(url,function(data){
            var data = $.parseJSON(data)
            if (data.code==0){
                layer.msg(data.msg);
                return false;
            }else{
                $("#mpkg_appid").append(new Option("请选择母包游戏",""));
                $.each(data.data,function(index,item){
                    $("#mpkg_appid").append(new Option(item.appname,item.appid));
                });
                layui.form.render("select");
            }
        });
        $("#submit").click();
    }

    $('#reset').click(function () {
        var starttime = getBeforeDate(-7);
        var endtime = getBeforeDate(0);
        $('#starttime').val(starttime);
        $('#endtime').val(endtime);
        $('#medium_id').val('');
        $('#depid').val('');
        $('#platform').val('');
        $('#channelid').val('');
        $('#adv_channelid').val('');
        $('#plan_channelid').val('');
        $('#optimize').val('');
        $('#dimension').val('');
        $('#mpkg_appid').val('');
        $('#data_type').val('');
        $('#advertiser_remark').val('');
        $('#typeid').val('');
        $("#skin_appid").empty();
        $('#source_type').val('');

        $('#toutiao_bid_type').val('');
        $('#toutiao_native').val('');


        $('#ks_bid_type').val('');
        $('#ks_tool').val('');
        $('#ks_native').val('');


        $('#gdt_bid_type').val('');


        $('#pkgname').val('');

        layui.form.render();
        layui.formSelects.render('skin_appid');
        layui.formSelects.render('medium_id');
        layui.formSelects.render('optimize');

        layui.formSelects.render('toutiao_position');
        layui.formSelects.render('ks_position');
        layui.formSelects.render('gdt_position');
        layui.formSelects.render('toutiao_tool');
    });

    function show_bid_query(medium_id) {
        if (medium_id == 6 || medium_id == 14) {
            //头条
            $(".toutiao_bid_query").show();
            $(".gdt_bid_query").hide();
            $(".ks_bid_query").hide();

        } else if (medium_id == 8) {
            $(".gdt_bid_query").show();
            $(".ks_bid_query").hide();
            $(".toutiao_bid_query").hide();
        } else if (medium_id == 9) {
            //快手
            $(".gdt_bid_query").hide();
            $(".ks_bid_query").show();
            $(".toutiao_bid_query").hide();
        } else {
            $(".gdt_bid_query").hide();
            $(".ks_bid_query").hide();
            $(".toutiao_bid_query").hide();
        }
    }
</script>
